home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / dsp / 56000tar.z / 56000tar / 56000 / speech / durbin1.hlp < prev    next >
Text File  |  1991-11-26  |  4KB  |  111 lines

  1.          Name: DURBIN1
  2.          Type: Assembler Program
  3.       Version: 1.2
  4.  Date Entered: 21-May-87
  5.   Last Change: 3-June-87
  6.  
  7. Description: Durbin Solution for PARCOR (LPC) Coefficients
  8.  
  9. This program uses the Durbin algorithm to find a set of PARCOR coefficients
  10. given an autocorrelation vector. These PARCOR coefficients can be used in
  11. speech analysis/synthesis systems such as vocoding, stochastic speech
  12. coding, multipulse speech coding, speech recognition, etc.
  13.  
  14. This program will solve any order system by equating the order "NK" to the
  15. number of K coefficients desired. The program is written as an illustrative
  16. example and the user may change the routine as needed. The program will:
  17.  
  18.   1. Read a data file to determine how many sets of PARCOR coefficients
  19.      to calculate.
  20.   2. Read the autocorrelations from a data file.
  21.   3. Perform the Durbin algorithm to find the K's.
  22.   4. Output the K coefficients to a data file.
  23.   5. Continue steps 2,3,4 for the number of specified sets of coefficients.
  24.  
  25. The explanation of the algorithm is beyond the scope of this help file but
  26. the coding of the algorithm can be easily understood by examining the C
  27. routine below (DURBIN). The C coding of the Durbin algorithm is a modified
  28. version of the original FORTRAN source code given on page 122 of the book
  29. entitled Practical Approaches to Speech Coding by Panos E. Papamichalis,
  30. (Prentice - Hall, 1987).
  31.  
  32. Approximate execution times for DURBIN1 on a 20.5 MHz DSP56000/1 are:
  33.  
  34.     NK = 8  (8th order) : 63.5  uS
  35.     NK = 10 (10th order): 85.6  uS
  36.     NK = 16 (16th order): 165.7 uS
  37.   
  38. Original FORTRAN source program: [1]
  39.  
  40.        SUBROUTINE DURBIN(R,N,K,A)
  41. C
  42. C      THIS ROUTINE USES THE DURBIN ALGORITHM TO
  43. C      TRANSFORM THE AUTOCORRELATION COEFFICIENTS R(1)-R(N+1)
  44. C      TO THE REFLECTION COEFFICIENTS K(1)-K(N) AND TO THE FILTER
  45. C      COEFFICIENTS A(1)-A(N+1) (A(1)=1).
  46. C
  47.        REAL    K(1),R(1),A(1)
  48. C
  49.        A(1) = 1
  50.        K(1) = -R(2) / R(1)
  51.        ALPHA = R(1) * (1 - K(1)**2)
  52.        A(2) = K(1)
  53.        DO 200 I = 2,N
  54.             ERROR = 0.
  55.             DO 100 J = 1,I
  56.                  ERROR = ERROR + A(J) * R(I+2-J)
  57. 100         CONTINUE
  58.             K(I) = - ERROR / ALPHA
  59.             ALPHA = ALPHA * (1 - K(I)**2)
  60.             A(I+1) = K(I)
  61.             DO 200 J = 2,I
  62.                  A(J) = A(J) + K(I) * A(I+2-J)
  63. 200    CONTINUE
  64.        RETURN
  65.        END
  66.  
  67. Modified C source for direct DSP56000/1 conversion:
  68.  
  69. /********************************************************
  70. *                                                       *
  71. * Durbin Algorithm for LPC Coefficients                 *
  72. *                                                       *
  73. ********************************************************/
  74. durbin(r,n,k,a)
  75. int n;
  76. double r[], k[], a[];
  77. {
  78.     int i, j;
  79.     double anew[NK+1], alpha, error;
  80.  
  81.     a[0] = 1.0;
  82.     anew[0] = 1.0;
  83.     k[0] = -r[1]/r[0];
  84.     alpha = r[0] * (1.0 - (k[0] * k[0]));
  85.     a[1] = k[0];
  86.     for( i = 2; i <= n; i++)
  87.         {
  88.         error = 0.0;
  89.         for( j = 1; j <= i; j++)
  90.             error = error + (a[j-1] * r[i-j+1]);
  91.         k[i-1] = -(error / alpha);
  92.         alpha = alpha * (1.0 - (k[i-1] * k[i-1]));
  93.         a[i] = k[i-1];
  94.         for( j = 2; j <= i; j++)
  95.             anew[j-1] = a[j-1] + (k[i-1] * a[i-j+1]);
  96.         for( j = 2; j <= i; j++)
  97.             a[j-1] = anew[j-1];
  98.         }
  99. }
  100.  
  101. References
  102.  
  103. [1] Papamichalis, Panos E., Practical Approaches to Speech Coding, Englewood
  104.     Cliffs, NJ: Prentice - Hall, 1987.
  105. [2] Rabiner, L.R. and R.W. Schafer, Digital Processing of Speech Signals,
  106.     Englewood Cliffs, NJ: Prentice - Hall, 1978.
  107. [3] Makhoul, John, "Linear Prediction: A Tutorial Review," Proceedings of
  108.     the IEEE, Volume 63 (April,1975): pp. 561 - 580.
  109.  
  110.  
  111.